﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using WebAppCoreDI.InitialData;
using WebAppCoreDI.Interface;
using WebAppCoreDI.Models;

namespace WebAppCoreDI.Controllers
{
    public class CharactersController : Controller
    {
        private readonly ICharacterRepository _characterRepository;

        public CharactersController(ICharacterRepository characterRepository)
        {
            _characterRepository = characterRepository;
        }

        // GET: /characters/
        public async Task<IActionResult> Index()
        {
         
            var models = await _characterRepository.ListAsync();

            return View(models);


        }

       
    }
}